#include <stdio.h>
#include <stdbool.h>
#include <ctype.h>
bool test_extension(const char *file_name, const char *extenson);
int main(void)
{
    printf("%d\n", test_extension("memo.txt", "TXT"));
    printf("%d\n", test_extension("txt", "txt"));
    printf("%d\n", test_extension("memo.txt.bak", "TxT"));
    printf("%d\n", test_extension("memo.txt.bak", "Bak"));
    return 0;
}
bool test_extension(const char *file_name, const char *extenson) {
    const char *s1 = file_name, *s2 = extenson;
    while (*s1)
        s1++;
    for(; s1 - file_name; s1--) 
        if (*s1 == '.') {
            s1++;
            break;
        }
    if (s1 - file_name == 0)
        return false;
    for (; *s1 && *s2; s1++, s2++) {
        if (toupper(*s1) != toupper(*s2))
            return false;
    }
    return true;
}